package com.truesai.entities.stock;

import java.math.BigDecimal;
import java.sql.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.truesai.dto.Gender;
import com.truesai.entities.employee.Employee;
/**
 * 仓库详细信息<br/>
 * 需求分析<br/>
 * <strong>唯一性:</strong>仓库名称。
 * @author XuLian
 *
 */
@Entity
@NamedQueries(
{
        @NamedQuery(name = Warehouse.ALL, query = "Select w from Warehouse w"),
        @NamedQuery(name = Warehouse.BY_NAME, query = "Select w from Warehouse w where w.name = :name"),
        @NamedQuery(name = Warehouse.BY_ID, query = "Select w from Warehouse w where w.id = :id") })
@Table(name = "warehouses")
public class Warehouse {
	public static final String ALL = "Warehouse.all";

    public static final String BY_NAME = "Warehouse.byName";

    public static final String BY_ID = "Warehouse.byId";
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    /**仓库名称*/
    @Column(nullable = false)
    private String name;
    
    /**仓库地址*/
    @Column
    private String address;
    
    /**联系电话（手机）*/
    @Column
    private String cellphone;
    
    /**联系电话（座机）*/
    @Column
    private String telephone;
    
    /**仓库管理员*/
    @ManyToOne
    private Employee warehouseman;
    
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	/**@see #name  */
	public String getName() {
		return name;
	}

	/**@see #name  */
	public void setName(String name) {
		this.name = name;
	}

	/**@see #address  */
	public String getAddress() {
		return address;
	}

	/**@see #address  */
	public void setAddress(String address) {
		this.address = address;
	}

	/**@see #cellphone  */
	public String getCellphone() {
		return cellphone;
	}

	/**@see #cellphone  */
	public void setCellphone(String cellphone) {
		this.cellphone = cellphone;
	}

	/**@see #telephone  */
	public String getTelephone() {
		return telephone;
	}

	/**@see #telephone  */
	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

    @Override
    public String toString() {
    	return name;
    }
    
    public Warehouse() { }
    
    public Warehouse(String name, String address, String cellphone, String telephone, Employee warehouseman) {
    	this.name = name;
    	this.address = address;
    	this.cellphone = cellphone;
    	this.telephone = telephone;
    	this.warehouseman = warehouseman;
    }
}
